Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
How do you add a "No Value found" for the search function? (Google App Script)

JAVASCRIPT CODES:

//CODE FOR SEARCH FUNCTION

function searchData(formObject){  
  var result = [];
  if(formObject.searchtext){//Execute if form passes search text
      var data = Sheets.Spreadsheets.Values.get(globalVariables().spreadsheetId, globalVariables().dataRage).values;
      for(var i=0;i<data.length;i++){
        for(var j=0;j<data[i].length;j++){
          if(data[i][j].toLowerCase().search(formObject.searchtext.toLowerCase())!=-1){
            result.push(data[i])
          }
        }
      }
  }
  return result;
}

//SEARCH DATA

  function handleSearchForm(formObject) {
    google.script.run.withSuccessHandler(createTable).searchData(formObject);
    document.getElementById("search-form").reset();
  }

HTML CODES //SEARCH FORM HTML

<form id="search-form" class="form-inline" onsubmit="handleSearchForm(this)">
  <div class="form-group mx-sm-3 mb-2">
    <label for="searchtext" class="sr-only">Search Text</label>
    <input type="text" class="form-control form-control-sm" id="searchtext" name="searchtext" placeholder="Search">
  </div>
  <button type="submit" class="btn btn-sm btn-primary mb-2">Search</button>
</form>

I was wondering it would be user friendly if I have a "no values found" if I search for something for the database.

Would be great to have some tips! Thank you very much!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!